package com.pencilisland.pay.mgt.console.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.pencilisland.pay.mgt.console.entity.SysRoleObj;

public interface RoleObjRepository extends CrudRepository<SysRoleObj, Long> {

	List<SysRoleObj> findByRoleIdOrderByObjTypeAsc(long roleId);

	@Modifying
	@Query("delete from SysRoleObj a where a.roleId=?1")
	void deleteByRoleId(Long roleId);

	List<SysRoleObj> findByRoleIdAndObjType(Long id, String objType);

	@Modifying
	@Query("delete from SysRoleObj a where a.roleId=?1 and a.objType=?2")
	void deleteByRoleIdAndObjType(Long roleId, String objType);

	List<SysRoleObj> findByObjIdAndObjType(Long objId, String objType);

}
